<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-name" data-rule="required" class="form-control" name="row[name]" type="text" value="{$row.name|htmlentities}">
        </div>
    </div>
    <div class="form-group row">
        <label class="control-label col-xs-12 col-sm-2">自定义表单:</label>
        <div class="col-xs-12 col-sm-8">
            <table class="table fieldlist" data-template="eventtpl" data-name="row[diy_form]" id="second-table">
                <tr>
                    <td>{:__('名称')}</td>
                    <td>{:__('key')}</td>
                    <td>{:__('格式')}</td>
                    <td>{:__('获取验证码')}</td>
                    <td>{:__('验证字段')}</td>
                    <td width="100"></td>
                </tr>
                <tr>
                    <td colspan="4"><a href="javascript:;" class="btn btn-sm btn-success btn-append"><i class="fa fa-plus"></i> {:__('Append')}</a></td>
                </tr>
            </table>

            <!--请注意实际开发中textarea应该添加个hidden进行隐藏-->
            <textarea name="row[diy_form]" style="display: none;" cols="30" rows="5">{$row.diy_form}</textarea>
            <script id="eventtpl" type="text/html">
                <tr class="form-inline">
                    <td><input type="text" name="<%=name%>[<%=index%>][name]" class="form-control" value="<%=row.name%>"/></td>
                    <td><input type="text" name="<%=name%>[<%=index%>][key]" class="form-control" value="<%=row.key%>"/></td>
                    <td><input type="text" name="<%=name%>[<%=index%>][format]" class="form-control selectpage" data-source='[{"key":"phone","name":"手机号"},{"key":"id_card","name":"身份证号"},{"key":"email","name":"邮箱"},{"key":"text","name":"文本"}]' data-field="name" data-primary-key="key" value="<%=row.format%>"/></td>
                    <td>
                        <input type="hidden" name="<%=name%>[<%=index%>][verify_code]" id="c-state-<%=index%>" class="form-control" style="width:50px" value="<%=row.verify_code%>" placeholder="验证码"/>
                        <a href="javascript:;" data-toggle="switcher" class="btn-switcher" data-input-id="c-state-<%=index%>" data-yes="1" data-no="2">
                            <i class="fa fa-toggle-on text-success <%if(row.verify_code!=1){%>fa-flip-horizontal text-gray<%}%> fa-2x"></i>
                        </a>
                    </td>
                    <td><input type="text" name="<%=name%>[<%=index%>][verify_field]" class="form-control selectpage" data-source='[{"field":"data1"},{"field":"data2"},{"field":"data3"},{"field":"data4"},{"field":"无"}]' data-field="field" data-primary-key="field" value="<%=row.verify_field||'无'%>"/></td>
                    <td>
                        <!--下面的两个按钮务必保留-->
                        <span class="btn btn-sm btn-danger btn-remove"><i class="fa fa-times"></i></span>
                        <span class="btn btn-sm btn-primary btn-dragsort"><i class="fa fa-arrows"></i></span>
                    </td>
                </tr>
            </script>
        </div>
    </div>

    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
        </div>
    </div>
</form>
